package cn.wizzer.app.user.modules.models.enums;

/**
 * @author zl
 * @date 2020/6/18 16:36
 */
public enum UserColEnum {

    IS_ONLINE("isOnline", "is_online"),
    DISABLED("disabled", "disabled"),
    ANCHOR("isAnchor", "anchor"),
    ROOM_MANAGER("isRoomManager", "room_manager"),
    SESSION_DISABLED("sessionDisabled", "session_disabled"),
    IS_COLLECT("isCollect", "is_collect"),
    PLAYABLE("playable", "playable"),
    AGENT("isAgent", "agent"),
    CERTIFIED("isCertified", "certified"),
    ATTENDANT("isAttendant", "attendant");

    private String name;
    private String val;

    UserColEnum(String name, String val) {
        this.name = name;
        this.val = val;
    }

    public String getName() {
        return name;
    }

    public String getVal() {
        return val;
    }

    /**
     * 根据名称查出数据库字段名
     *
     * @param name
     * @return
     */
    public static String getValByName(String name) {
        for (UserColEnum userColEnum : UserColEnum.values()) {
            System.out.println(userColEnum.getName());
            if(name.equals(userColEnum.getName())){
                return userColEnum.getVal();
            }
        }
        return null;
    }

}
